<template>
  <div id="qrCode">
    <!-- <div id="code"></div> -->
    <canvas id="canvas" style='width:250px;height:200px'></canvas>
  </div>
</template>
<script>
import QRCode from "qrcode";
import {Toast, Dialog} from 'vant'
export default {
  props: {
    url: {
      type: String
    }
  },
  data() {
    return {
      codes: ""
    };
  },

  components: {
    QRCode: QRCode
  },

  methods: {
    useqrcode() {
      var canvas = document.getElementById("canvas");
      QRCode.toCanvas(canvas, this.url, function(error) {
        ///if (error) console.error(error);
        this.$router.push({
                      path: '/myCompany/staffRollCall',
                    })  
      });
    }
  },

  mounted() {
    this.useqrcode();
  }
};
</script>
<style lang="less" scoped>
#qrCode {
    width:100%;
    height:250px;
  text-align: center;
  #canvas{
      width:100% !important;
      height:250px !important;
  }
}
</style>